#include("../_common/form_input.html")
#include("../_common/form_radio.html")
#include("../_common/form_input_read.html")
#include("../_common/upload_image.html")
#@admin_header()
<!-- 内容主体区域 -->
<div class="layui-body">
  <div style="padding: 15px;">
    <form class="layui-form layui-form-pane">
      <div class="site-block">
        #@form_input("nick_name", "用户昵称", user.nick_name, "用户的昵称", "用户的昵称，显示在右上角那里")
        #@upload_image("user_icon", "个人头像", user.icon, "这里显示的是图片的路径", "用户的头像，右上角那里显示的")
        #setLocal(map1 = {"name":"gender","value":"male","title":"男", "checked":user.gender==com.ywyself.model.User::GENDER_MALE ? "checked" : ""})
        #setLocal(map2 = {"name":"gender","value":"female","title":"女", "checked":user.gender==com.ywyself.model.User::GENDER_FEMALE ? "checked" : ""})
        #setLocal(list = {k1:map1, k2:map2})
        #@form_radio(list, "性&nbsp;&nbsp;&nbsp;&nbsp;别", "就是性别，没其他的意思")
        #@form_input("email", "邮箱地址", user.email, "邮箱", "常用的邮箱，目前没啥子用")
        #@form_input_read("status", "账号状态", user.status==com.ywyself.model.User::STATUS_ACTIVE ? "已启用" : "未启用", "", "账户是否激活")
        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-filter="info" lay-submit="">立即提交</button>
            <button class="layui-btn layui-btn-primary" type="reset">重置</button>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>
<script>
  //JavaScript代码区域
  layui.use(['form'], function () {
    var form = layui.form;
    form.render();
    // 自定义验证
    form.verify({
      nick_name: function (value) {
        if (value == '') {
          return '用户昵称不能为空';
        }
      },
      email: function (value) {/*消掉框架中的邮箱验证*/
      }
    });
    // 提交
    form.on('submit(info)', function (data) {
      ToastLoading('正在保存...');
      $.post("#(adminRoot)/user/info/save", data.field)
        .success(function (ret) {
          ToastShow(ret.code, ret.msg, ret.url);
        })
        .error(function () {
          ToastErr('网络错误');
        })
      return false;
    });
  });
</script>
#@admin_footer()
